package com.song.yunpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.song.yunpicturebackend.model.dto.user.UserLoginReq;
import com.song.yunpicturebackend.model.dto.user.UserQueryReq;
import com.song.yunpicturebackend.model.dto.user.UserRegisterReq;
import com.song.yunpicturebackend.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.song.yunpicturebackend.model.vo.LoginUserVO;
import com.song.yunpicturebackend.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author Administrator
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2024-12-28 14:13:07
*/
public interface UserService extends IService<User> {

    /**
     * 是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(User user);


    /**
     * 用户注册
     * @param userRegisterReq
     * @return
     */
    long userRegister(UserRegisterReq userRegisterReq);

    /**
     * 用户登陆
     * @param userLoginReq
     * @return
     */
    LoginUserVO userLogin(UserLoginReq userLoginReq, HttpServletRequest request);

    /**
     * 获取登录用户信息
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);


    /**
     * 密码加密
     * @param userPassword
     * @return
     */
    String getEncryptPassword(String userPassword);

    /**
     * 获取脱敏后的用户登录信息
     * @param user
     * @return
     */
    LoginUserVO getLoginUserVO(User user);

    /**
     * 获取脱敏后的用户信息
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     * 获取脱敏后的用户信息列表
     * @param userList
     * @return
     */
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 获取用户查询条件
     * @param userQueryReq
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryReq userQueryReq);

}
